//
//  GMGroupCell.m
//  Teecloud
//
//  Created by 小熊 on 2018/10/24.
//  Copyright © 2018年 小志. All rights reserved.
//

#import "GMGroupCell.h"
@interface GMGroupCell()
@property (weak, nonatomic) IBOutlet UIImageView *firImg;
@property (weak, nonatomic) IBOutlet UIImageView *secImg;
@property (weak, nonatomic) IBOutlet UIImageView *thrImg;
@property (weak, nonatomic) IBOutlet UIImageView *forImg;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UIButton *biaoqian;
@property (weak, nonatomic) IBOutlet UILabel *desLab;
@property (weak, nonatomic) IBOutlet UILabel *people;
@property (weak, nonatomic) IBOutlet UILabel *state;

@end
//培训中
#define KTrainColor [UIColor colorWithHexString:@"#FF9900" andAlpha:1.0]
@implementation GMGroupCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.biaoqian.layer.borderWidth = 0.5f;
    self.biaoqian.layer.borderColor = KTrainColor.CGColor;
    self.biaoqian.layer.cornerRadius = 3.0f;
    self.biaoqian.clipsToBounds = YES;
}
-(void)setModel:(GMGroupModel *)model{
    _model = model;
    for (NSInteger i =0; i<model.HeadUrls.count; i++) {
        NSString *imgurl =model.HeadUrls[i];
        if (i==0) {
            [self.firImg yy_setImageWithURL:[NSURL URLWithString:imgurl] placeholder:DefealtImg];
        }else if (i==1){
            [self.secImg yy_setImageWithURL:[NSURL URLWithString:imgurl] placeholder:DefealtImg];
        }else if (i==2){
            [self.thrImg yy_setImageWithURL:[NSURL URLWithString:imgurl] placeholder:DefealtImg];
        }else if (i==3){
            [self.forImg yy_setImageWithURL:[NSURL URLWithString:imgurl] placeholder:DefealtImg];
        }else{
            
        }
    }
    self.name.text = model.Name;
    [self.biaoqian setTitle:[NSString stringWithFormat:@"  %@  ",model.GroupTypeName] forState:UIControlStateNormal];
    self.desLab.text = model.Manager;
    NSString *peoStr = [NSString stringWithFormat:@"%@人",model.MemberCount];
    self.people.attributedText = [NSMutableAttributedString String:peoStr RangeString:[NSString stringWithFormat:@"%@",model.MemberCount]];

    if (!kIsEmptyString(model.DoingName) || model.IsAdded) {
        self.state.hidden =NO;
        if (!kIsEmptyString(model.DoingName)) {
            if ([model.DoingName isEqualToString:@"进行中"]) {
                self.state.backgroundColor = k0065EAColor;
            }else{
                self.state.backgroundColor = kLightGrayColor;
            }
            self.state.text = model.DoingName;
        }else{
            self.state.text = @"已加入";
            self.state.backgroundColor = kLightGrayColor;
        }
        
    }else{
        self.state.hidden =YES;
    }
    
}

@end
